package com.thx.information.model;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@SuppressWarnings("serial")
@Entity
@Table(name = "INFORMATION")
public class Information implements java.io.Serializable {

  private static final long serialVersionUID = 1L;

  public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
  }

  @Id
  /*
   * @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="payablemoney_seq")
   * 
   * @SequenceGenerator(name="payablemoney_seq", sequenceName="SEQ_INFOMATION",allocationSize=1)
   */

  @GeneratedValue(strategy = GenerationType.TABLE, generator = "tab-store")
  @TableGenerator(name = "tab-store", table = "tb_generator", pkColumnName = "gen_name",
      valueColumnName = "gen_value", pkColumnValue = "SEQ_INFOMATION", allocationSize = 1)
  // Fields

  private Long infoId; // 信息id
  private Long columnId;
  private Long enterpriseId;
  private String infoTitle; // 信息标题
  private String infoContent; // 信息内容
  private String canComment; // 可以评论
  private String canVote; // 可以投票
  private String itemForm; // 项目形式
  private String voteMode; // 投票模式
  private String issueStatus; // 发布状态
  private String voteStatus; // 投票状态
  private String perBound; // 人员绑定
  private String deptBound; // 部门绑定
  private String roleBound; // 角色绑定
  private String selDataPerName; // 人员名称字符串
  private String selDataDeptName; // 部门名称字符串
  private String selDataRoleName; // 角色名称字符串
  private Long createUserId; // 创建人id
  private String createUser; // 创建人
  private Date createTime; // 创建时间
  private String updateUser; // 更新人
  private Date updateTime; // 更新时间

  // zhangyong 20141105 文件类型
  private String infoType;
  // fengjinshou 20140721 用于判断是否可以编辑，通过公文发布不能进行编辑
  private String ifEditor;

  /** default constructor */
  public Information() {}

  /** minimal constructor */
  public Information(Long infoId) {
    this.infoId = infoId;
  }

  /** full constructor */
  public Information(Long infoId, Long columnId, Long enterpriseId, String infoTitle,
      String infoContent, String canComment, String canVote, String itemForm, String voteMode,
      String issueStatus, String deptBound, String perBound) {
    this.infoId = infoId;
    this.columnId = columnId;
    this.enterpriseId = enterpriseId;
    this.infoTitle = infoTitle;
    this.infoContent = infoContent;
    this.canComment = canComment;
    this.canVote = canVote;
    this.itemForm = itemForm;
    this.voteMode = voteMode;
    this.issueStatus = issueStatus;
    this.deptBound = deptBound;
    this.perBound = perBound;
  }

  // Property accessors

  public Long getInfoId() {
    return this.infoId;
  }

  public void setInfoId(Long infoId) {
    this.infoId = infoId;
  }

  public Long getColumnId() {
    return this.columnId;
  }

  public void setColumnId(Long columnId) {
    this.columnId = columnId;
  }

  public Long getEnterpriseId() {
    return this.enterpriseId;
  }

  public void setEnterpriseId(Long enterpriseId) {
    this.enterpriseId = enterpriseId;
  }

  public String getInfoTitle() {
    return this.infoTitle;
  }

  public void setInfoTitle(String infoTitle) {
    this.infoTitle = infoTitle;
  }

  public String getInfoContent() {
    return this.infoContent;
  }

  public void setInfoContent(String infoContent) {
    this.infoContent = infoContent;
  }

  public String getCanComment() {
    return this.canComment;
  }

  public void setCanComment(String canComment) {
    this.canComment = canComment;
  }

  public String getCanVote() {
    return this.canVote;
  }

  public void setCanVote(String canVote) {
    this.canVote = canVote;
  }

  public String getItemForm() {
    return this.itemForm;
  }

  public void setItemForm(String itemForm) {
    this.itemForm = itemForm;
  }

  public String getVoteMode() {
    return this.voteMode;
  }

  public void setVoteMode(String voteMode) {
    this.voteMode = voteMode;
  }

  public String getIssueStatus() {
    return this.issueStatus;
  }

  public void setIssueStatus(String issueStatus) {
    this.issueStatus = issueStatus;
  }

  public String getDeptBound() {
    return this.deptBound;
  }

  public void setDeptBound(String deptBound) {
    this.deptBound = deptBound;
  }

  public String getPerBound() {
    return this.perBound;
  }

  public void setPerBound(String perBound) {
    this.perBound = perBound;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public String getUpdateUser() {
    return updateUser;
  }

  public void setUpdateUser(String updateUser) {
    this.updateUser = updateUser;
  }

  public Date getUpdateTime() {
    return updateTime;
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime;
  }

  public String getCreateUser() {
    return createUser;
  }

  public void setCreateUser(String createUser) {
    this.createUser = createUser;
  }

  public String getVoteStatus() {
    return voteStatus;
  }

  public void setVoteStatus(String voteStatus) {
    this.voteStatus = voteStatus;
  }

  public String getIfEditor() {
    return ifEditor;
  }

  public void setIfEditor(String ifEditor) {
    this.ifEditor = ifEditor;
  }

  public String getInfoType() {
    return infoType;
  }

  public void setInfoType(String infoType) {
    this.infoType = infoType;
  }



  public String getRoleBound() {
    return roleBound;
  }

  public void setRoleBound(String roleBound) {
    this.roleBound = roleBound;
  }

  public String getSelDataDeptName() {
    return selDataDeptName;
  }

  public void setSelDataDeptName(String selDataDeptName) {
    this.selDataDeptName = selDataDeptName;
  }

  public String getSelDataPerName() {
    return selDataPerName;
  }

  public void setSelDataPerName(String selDataPerName) {
    this.selDataPerName = selDataPerName;
  }

  public String getSelDataRoleName() {
    return selDataRoleName;
  }

  public void setSelDataRoleName(String selDataRoleName) {
    this.selDataRoleName = selDataRoleName;
  }

  public Long getCreateUserId() {
    return createUserId;
  }

  public void setCreateUserId(Long createUserId) {
    this.createUserId = createUserId;
  }

  public String getAllBoundName() {
    String s = "";
    if (StringUtils.isNotBlank(selDataPerName)) {
      s += "人员：" + selDataPerName + ";";
    }
    if (StringUtils.isNotBlank(selDataDeptName)) {
      s += "部门：" + selDataDeptName + ";";
    }
    if (StringUtils.isNotBlank(selDataRoleName)) {
      s += "角色：" + selDataRoleName + ";";
    }
    if (StringUtils.isBlank(s)) {
      s = "全部";
    }
    return s;
  }

}
